<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>上传文件成功...</title>
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/css/base.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/layui/css/layui.css">
<style type="text/css">
.layui-row {
	margin-top: 20px;
}
</style>

</head>
<body style="background-color: #FFFFFF;">
	<div class="layui-container">
		<div class="layui-row">
			<div class="layui-col-xs4">
				<label class="layui-form-label">用户名:</label>
			</div>
			<div class="layui-col-xs6">
				<input type="text" name="username" required lay-verify="required"
					autocomplete="off" placeholder="请输入用户名" class="layui-input">
			</div>
		</div>

		<div class="layui-row">
			<div class="layui-col-xs4">
				<label class="layui-form-label">密码:</label>
			</div>
			<div class="layui-col-xs6">
				<input type="password" name="password" required
					lay-verify="required" placeholder="请输入密码" autocomplete="off"
					class="layui-input">
			</div>
		</div>


		<div class="layui-row">
			<div class="layui-col-xs4 layui-col-xs-offset5">
				<button class="layui-btn layui-btn-lg layui-btn-normal" name="login">登录</button>
			</div>
		</div>
	</div>
	<script src="/lib/jquery.min.js"></script>
	<script src="${pageContext.request.contextPath}/layui/layui.all.js"></script>
	<script src="${pageContext.request.contextPath}/js/tools.js"></script>
	<script src="${pageContext.request.contextPath}/js/myajax.js"></script>
	<script type="text/javascript">
		$("body").keydown(function() {
			if (event.keyCode == "13") {//keyCode=13是回车键
				$("button[name='login']").click();
			}
		});
		$("button[name='login']").click(function() {
			gb.XHR({
				url : "/islogin",
				queryParams : {
					'username' : $("input[name='username']").val(),
					'password' : $("input[name='password']").val()
				},
				type : "post",
				contentType : "application/x-www-form-urlencoded",
				isAsync : true,
				callback : function(data) {
					if (data.success) {
						gb.setCookie("username", data.data.USERNAME, "h12");

						layer.msg('登录成功！');

						setTimeout(function() {
							top.location.reload();
						}, 1500);
					} else {
						layer.msg('用户名或密码错误！', {
							time : 1500
						});
					}
				}
			});
		});
	</script>
</body>
</html>